<template>
  <div class="box">
    <div class="back" @click="login">
      <i class="el-icon-arrow-left"></i>登录
    </div>
    <div class="text">
      <el-input
        placeholder="请输入手机号/账号"
        v-model="username"
        clearable>
      </el-input>
    </div>
    <div>
      <el-input placeholder="请输入密码" v-model="password" type="password"></el-input>
    </div>
    <el-row>
      <el-button type="success" class="login" @click="tohome">登 录</el-button>
      <el-button type="success" class="login" @click="tologin">注 册</el-button>
    </el-row>
    <p class="forget" >忘记密码>>></p>
  </div>
</template>
<script>
  export default {
    data () {
      return {
        username: '',
        password: '',
        flag: false
      }
    },
    methods: {
      tohome () {
        if (this.password === '123456' && this.username === '123') {
          this.$store.dispatch('changeLogin', true)
          this.$store.dispatch('changeNewLogin', false)
          this.$router.push('/')
        }
        if (this.password === '123' && this.username === '123') {
          this.$store.dispatch('changeLogin', true)
          this.$store.dispatch('changeNewLogin', false)
          this.$store.dispatch('changeMember', true)
          this.$router.push('/')
        }
      },
      login () {
        this.$router.push('/login')
      },
      tologin () {
        this.$store.dispatch('changeNewLogin', true)
        this.$toast.center('您已注册成功')
        this.$router.push('/login')
      }
    }
  }
</script>
<style lang="stylus" type="text/stylus" scoped>
  @import '../../common/stylus/mixin.styl'
  body
    background-color :#cccccc
    .box
      .back
        width :100%
        height :40px
        background-color :blue
        line-height :40px
        color :white
        padding-left :10px
        font-size :14px
        i
          margin-right :20px
      .text
        margin-top :8px
        margin-bottom :4px
    .login
      width :90%
      margin-left :5%
      margin-top :8px
    .forget
      margin-top :20px
      float :right
      margin-right :20px
      color :green
      font-size :12px
</style>
